<template>
	<view class="padding">
		<view class="team-head-info">
			<view class="col">
				<view class="b">{{total_members || 0}}</view>
				<p>团队总人数</p>
			</view>
			<view class="col">
				<view class="b">{{total_recharge || 0}}</view>
				<p>团队总充值</p>
			</view>
			<view class="col">
				<view class="b">{{total_cash || 0}}</view>
				<p>团队总提现</p>
			</view>
			<view class="col">
				<view class="b">{{total_investment || 0}}</view>
				<p>团队总投资</p>
			</view>
			<view class="col">
				<view class="b">{{total_waitmoney || 0}}</view>
				<p>团队待返本金</p>
			</view>
			<view class="col">
				<view class="b">{{total_zhitui || 0}}</view>
				<p>直荐总人数</p>
			</view>
<!-- 			<view class="ckgd" data_zt="0">
				<p>查看升级团长进度<i class="ew-tree-icon layui-icon layui-icon-triangle-d"></i></p>
			</view>
			<view class="cksjtj" style="display: none;">
				<view class="css_tdbox">
					<view class="row tdbox-bet">
						<view class="left">满足下列条件，即可升级为【星际团队长】</view>
					</view>
					<view class="row tdbox-bet">
						<view class="left">直荐有效人数：</view>
						<view class="right">0/8</view>
					</view>
					<view class="row tdbox-bet">
						<view class="left">总团队有效人数：</view>
						<view class="right">707/0</view>
					</view>
					<view class="row tdbox-bet">
						<view class="left">团队总投资：</view>
						<view class="right">43132500/300000.00</view>
					</view>
					<view class="tuanzhang-jindu-box">
						<view class="progress-bar-txt tdbox-bet"><span>距离升级完成进度:</span><b>66.67%</b></view>
						<view class="progress-bar">
							<view class="slider" style="width:66.67%;"></view>
						</view>
					</view>
				</view>
			</view> -->
		</view>
		<view class="table-container">
			<n-table
				:headerOpt="headerOpt"
				:nameOpt="{isShow:false, title: '树形表格2',needMenu:true}"
				:tableOpt="{}"
				:tableHeight="0"
				:tableData="tableDataTree"
				:columns="columns"
				colKey="dataIndex"
				idKey="key"
				></n-table>
		</view>
	</view>
</template>
<script>
	import nTable from '@/components/n-table/n-table.vue';
	import {baseColumns, treeColumnsData} from "@/common/tableData.js"
	export default {
		components:{
			nTable
		},
		data() {
			return {
				list:[],
				ifOnShow:false,
				headerOpt: {},
				tableDataTree: false,
				columns: false,
				total_cash:0,
				total_investment:0,
				total_members:0,
				total_recharge:0,
				total_zhitui:0,
				total_waitmoney:0,
			};
		},
		onLoad(option) {
			this.helper.checkLogin();
			this.getData();
		},
		mounted() {
			setTimeout(() => {
				this.columns = baseColumns
				// this.tableDataTree = treeColumnsData
			}, 1000)
		},
		methods: {
			getData(){
				//获取基础参数
				uni.showLoading({
					title:"数据加载中",
					mask:true
				})
				var info = uni.getStorageSync("userinfo");
				console.log('info',info);
				if(info.token){
					let timestamp = this.helper.now();
					let sign = this.helper.setSign(['username='+info.username,'token='+info.token,'timestamp='+timestamp]);
					this.helper.req({
						api:"getTeamInfo",
						timestamp:timestamp,
						data:{username:info.username,token:info.token},
						header:{sign:sign},
						method:'GET',
					}).then(res=>{
						console.log('res',res);
						// this.tableDataTree = res.data.data.team_members;
						// this.total_cash = res.data.data.total_cash;
						// this.total_recharge = res.data.data.total_recharge;
						// this.total_investment = res.data.data.total_investment;
						// this.total_members = res.data.data.total_members;
						// this.total_zhitui = res.data.data.team_members.length || 0;
						// this.total_waitmoney= res.data.data.total_waitmoney;
						// setTimeout(() => {
							uni.hideLoading();
						// }, 300);
					})
				}else{
					uni.hideLoading();
				}
			},
		},
	};
</script>

<style lang="scss">
	.padding {
		padding: 15px 11px;
		.team-head-info {
			height: auto;
			border-radius: 0.68rem;
			margin-bottom: 0rem;
			display: flex;
			align-items: center;
			justify-content: center;
			flex-wrap: wrap;
			align-content: center;
			background: linear-gradient(186deg,rgba(255, 85, 0, 1.0) 0%, rgba(255, 170, 127, 1.0) 100%);
			box-shadow: 0.2048rem 0.191rem 0.32rem 0px rgba(16, 115, 195, 0.27);
		}
		.team-head-info .col {
			width: 33%;
			position: relative;
			display: flex;
			align-items: center;
			justify-content: center;
			height: 3.4rem;
		}
		.team-head-info .b {
			word-break: break-all;
		}
		.team-head-info .b {
		  font-size: 1.04rem;
		  font-weight: 700;
		  letter-spacing: 0px;
		  line-height: 0.96rem;
		  color: #ffffff;
		  text-align: center;
		  vertical-align: top;
		  word-break: break-all;
		}
		.team-head-info p {
		  font-size: 0.88rem;
		  font-weight: 500;
		  letter-spacing: 0px;
		  line-height: 0.88rem;
		  color: #ffffff;
		  text-align: center;
		  vertical-align: top;
		}
		.ckgd {
			display: inline-block;
			width: 100%;
			padding-top: 0.5rem;
		}
	}
</style>